/** 向最后一位添加一个或多个元素并返回长度 */
const arr = [1, 2, 3];
console.log(arr.push(4, 5));
console.log(arr);

function myPush(...args) {
  for (let i = 0; i < args.length; i++) {
    this[this.length] = args[i];
  }
  return this.length;
}

Array.prototype.myPush = myPush;

const arr2 = [1, 2, 3];
console.log(arr2.myPush(4, 5));
console.log(arr2);
